/*
 * @Author: AskMeWhy
 * @Date: 2020-09-14 16:48:31
 * @Last Modified by: AskMeWhy
 * @Last Modified time: 2020-12-28 18:23:00
 */
import Vue from "vue";
import ComponentTemplate from "./form.vue";
const VueComponent = Vue.extend(ComponentTemplate);

export const dialogForm = (option: any) => {
    const vm: any = new VueComponent().$mount();
    vm.value = option.value || "";
    vm.valueNew = option.valueNew || "";
    vm.$on("onchange", (item: any) => {
        if (option && option.onChange) option.onChange(vm, item);
    });
    vm.$on("sure", (model: any) => {
        if (option && option.sure) option.sure(vm, model);
    });
    vm.show = true;
    return vm;
};
